<?php
	include_once("../include/init.php");
	include_once("admin_init.php");
	$id = $_GET['id'];
	$sql = "SELECT * FROM  tk_product_category where cate_id=$id";
	$res = mysql_query($sql);
	$info = mysql_fetch_assoc($res);
	$cname = $info['cate_name'];
	$parent_id =$info['parent_id'];

	$sql2 ="SELECT * FROM  tk_product_category";
	$rs = mysql_query($sql2);
	$arre = [];
	if(mysql_num_rows($rs)>0){
		while($list=mysql_fetch_assoc($rs)){
			$arre[]=$list;
		}
	}		
		$arr = get_cate($arre);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主体部分</title>
<base target="_self">
<link rel="stylesheet" type="text/css" href="skin/css/base.css" />
<link rel="stylesheet" type="text/css" href="skin/css/main.css" />
</head>
<body leftmargin="8" topmargin='8'>
<table width="98%" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px;margin-top:8px;">
  <tr>
    <td background="skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' colspan="2"><span><img src='skin/images/frame/arr3.gif' style='margin-right:10px;'>修改商品分类</span></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>
    	<form action="product_cate.php" method="post" >
		<table style="margin-bottom:8px;margin-top:8px;margin-left:20px;">
		<input type="hidden" name="id" value="<?= $id?>">		
			 <tr>
				<td width="100px;">上级分类:</td>
				<td><select name="parent_id">
				<option value='0'>顶级分类</option>
						<?php foreach( $arre as $vo){?>
				<option value="<?=$vo['cate_id']?>"<?=$parent_id==$vo['cate_id']?"selected":""?>> <?= $vo['cate_name']?></option>
						<?php }?>
					</select>
				</td>
			  </tr>
			   <tr>
				 <td>分类名称:</td>
				 <td><input type="text" name="cate_name" value="<?=$cname?>"/></td>
			   </tr>
			   <tr>
			   		<input type="hidden" name="act" value="edit"/>
				 <td colspan="2" align="center" height="40px"><input type="submit" value=" 修改 " class="coolbt2"></td>
			   </tr>
		</table>
		</form>
	</td>
  </tr>
</table>
</body>
</html>